<?php
/**
 * Created by PhpStorm.
 * Author: QinShuai
 * Email: qinshuai0423@qq.com
 * Date: 2021/7/8
 */
/* @var $this yii\web\View */
/* @var $generator yii\gii\generators\controller\Generator */
echo "<?php\n";
?>
/* @var $this yii\web\View */

$this->title = '通用后台管理';
?>
<div class="index">
    <div class="search">
        <div class="section-body">
            <!--搜索-->
            <el-form label-width="100px" label-position="left">
                <el-row>
                    <el-col :span="6">
                        <el-form-item label="用户名：">
                            <el-input
                                    placeholder="请输入内容"
                                    v-model="searchData.username"
                                    clearable>
                        </el-form-item>
                    </el-col>
                    <el-col :span="10">
                        <el-form-item label="时间：">
                            <el-date-picker
                                    v-model="searchData.times"
                                    type="datetimerange"
                                    range-separator="至"
                                    start-placeholder="开始日期"
                                    end-placeholder="结束日期">
                            </el-date-picker>
                        </el-form-item>
                    </el-col>
                    <el-col :span="3"><el-button type="primary" icon="el-icon-search" @click="searchInput">搜索</el-button></el-col>
                </el-row>
            </el-form>
        </div>
    </div>
    <div class="button">
        <el-row>
            <el-button>默认按钮</el-button>
            <el-button type="primary">主要按钮</el-button>
            <el-button type="success">成功按钮</el-button>
            <el-button type="info">信息按钮</el-button>
            <el-button type="warning">警告按钮</el-button>
            <el-button type="danger">危险按钮</el-button>
        </el-row>
    </div>

    <div class="content">
        <template>
            <el-table
                    :data="tableData"
                    style="width: 100%"
                    height="100%"
                    @selection-change="handleSelectionChange">
                <el-table-column
                        type="selection"
                        width="55">
                </el-table-column>
                <?php foreach ($generator->getTableInfo()->columns as $val){?><el-table-column
                        prop="<?=$val->name?>"
                        label="<?=$val->comment ?: $val->name?>"
                        sortable
                        width="120">
                </el-table-column>
                <?php } ?>
                <el-table-column label="操作">
                    <template slot-scope="scope">
                        <el-button
                                size="mini"
                                @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
                        <el-button
                                size="mini"
                                type="danger"
                                @click="handleDeleteConfirm(scope.$index, scope.row)">删除</el-button>
                    </template>
                </el-table-column>
            </el-table>
            <el-row type="flex" class="page" justify="end">
                <el-pagination
                        @size-change="handleSizeChange"
                        @current-change="handleCurrentChange"
                        :current-page="currentPage"
                        :page-sizes="pageSizes"
                        :page-size="pageSize"
                        layout="total, sizes, prev, pager, next, jumper"
                        :total="count">
                </el-pagination>
            </el-row>

        </template>
    </div>
</div>
<?php
echo "<?php";
?>
  $this->beginBlock('js'); ?>
<script>
    App = {
        data:{
            form: {
<?php foreach ($generator->getTableInfo()->columns as $val) {?>
                <?=$val->name?>: '',
<?php }?>
            },
            searchData:{
                username:'',
                times: [new Date(2021, 10, 10, 10, 10), new Date(2021, 10, 11, 10, 10)],
            },
        },
        methods: {
            afterHandleEdit:function (index, row){},
            afterHandleAdd:function (){},
            beforeSaveValidate:function (that){},
        }
    }
</script>
<?php
echo "<?php";
?>
  $this->endBlock(); ?>


